<% @main_header = "Ptrack: Search Results For #{params[:q]}"
sum=0
%>

<h3>Search Results</h3>

<% if @tasks.size > 0 %>
  <strong>Tasks</strong>
  <ul>
    <% for task in @tasks %>
      <% sum+=1 %>
      <li><%= link_to(task.name, project_tasks_url(task.project_id) + "/" + task.id.to_s ) %></li>
    <% end %>
  </ul>
<% else %>
<% end %>


<% if @notes.size > 0 %>
  <strong>Notes</strong>
  <ul>
    <% for note in @notes  %>
      <% sum+=1 %>
      <li><%= link_to(note.title, :controller => 'notes', :action => 'show', :id => note) %></li>
    <% end %>
  </ul>
<% else %>
<% end %>

<% if @users.size > 0 %>
  <strong>Users</strong>
  <ul>
    <% for user in @users
      sum+=1
    %>
      <li><%= link_to(user.login, :controller => 'users', :action => 'edit', :id => user) %></li>
    <% end %>
  </ul>
<% else %>
<% end %>

<% if @patterns.size > 0 %>
  <strong>Patterns</strong>
  <ul>
    <% for pattern in @patterns
      sum+=1
    %>
      <li><%= link_to(pattern.title, :controller => 'patterns', :action => 'show', :id => pattern) %></li>
    <% end %>
  </ul>
<% else %>
<% end %>

<% if @contacts.size > 0 %>
  <strong>Contacts</strong>
  <ul>
    <% for contact in @contacts
      sum+=1
    %>
      <li><%= link_to(contact.name, :controller => 'contacts', :action => 'show', :id => contact) %></li>
    <% end %>
  </ul>
<% else %>
<% end %>

<% if @documents.size > 0 %>
  <strong>Documents</strong>
  <ul>
    <% for document in @documents
      sum+=1
    %>
      <li><%= link_to(document.name, :controller => 'documents', :action => 'show', :id => document) %></li>
    <% end %>
  </ul>
<% else %>
<% end %>

<% if @projects.size > 0 %>
  <strong>Projects</strong>
  <ul>
    <% for project in @projects
      sum+=1
    %>
      <li><%= link_to(project.name, :controller => 'projects', :action => 'show', :id => project) %></li>
    <% end %>
  </ul>
<% else %>
<% end %>
<%= if sum==0
  'No Results Found.'
end
%>

